package cn.minsh.lims.eoms.modules.app.controller;

import cn.minsh.lims.eoms.common.utils.PageUtils;
import cn.minsh.lims.eoms.common.utils.R;
import cn.minsh.lims.eoms.modules.app.entity.UserInspectionPlanContentEntity;
import cn.minsh.lims.eoms.modules.app.service.UserInspectionPlanContentService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * 用户巡检内容
 *
 * @author lht
 * @email sunlightcs@gmail.com
 * @date 2021-04-26 02:30:42
 */
@RestController
@RequestMapping("sys/userInspectionPlanContent")
public class UserInspectionPlanContentController {
    @Autowired
    private UserInspectionPlanContentService userInspectionPlanContentService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("sys:userinspectionplancontent:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userInspectionPlanContentService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("sys:userinspectionplancontent:info")
    public R info(@PathVariable("id") Long id){
		UserInspectionPlanContentEntity userInspectionPlanContent = userInspectionPlanContentService.getById(id);

        return R.ok().put("userInspectionPlanContent", userInspectionPlanContent);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("sys:userinspectionplancontent:save")
    public R save(@RequestBody UserInspectionPlanContentEntity userInspectionPlanContent){
		userInspectionPlanContentService.save(userInspectionPlanContent);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("sys:userinspectionplancontent:update")
    public R update(@RequestBody UserInspectionPlanContentEntity userInspectionPlanContent){
		userInspectionPlanContentService.updateById(userInspectionPlanContent);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("sys:userinspectionplancontent:delete")
    public R delete(@RequestBody Long[] ids){
		userInspectionPlanContentService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
